package com.yang.springcloud.alibaba.controller;

import com.yang.springcloud.alibaba.domain.CommonResult;
import com.yang.springcloud.alibaba.service.AccountService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @Author yang
 * @Date 2022/8/29
 */
@RestController
public class AccountController {
    @Autowired
    private AccountService accountService;

    @RequestMapping("/account/decrease")
    public CommonResult decrease(@Param("userId") Long userId, @Param("money") BigDecimal money){
        accountService.decrease(userId, money);
        return new CommonResult<>(200,"扣减账户余额成功");
    }
}
